tests: Add test setup for introspection bindings in Python
authorJon Nordby <jononor@gmail.com>
Sun, 29 Jul 2012 13:39:27 +0000 (15:39 +0200)
committerJon Nordby <jononor@gmail.com>
Tue, 31 Jul 2012 16:42:45 +0000 (18:42 +0200)
This is essentially all we can test for now, as the
methods using the Babl type are show up with 'introspectable="1"'.

tests/Makefile.am
tests/introspection.py [new file with mode: 0755]

index a13270db08256d711acab6157690beee92ac0b2b..27e8bbd9a9f578c9b8e5a1262f3ef7406a19d602 100644 (file)
@@ -2,7 +2,7 @@ if OS_UNIX
 CONCURRENCY_STRESS_TEST = concurrency-stress-test 
 endif
 
-TESTS =                                \
+C_TESTS =                              \
        grayscale_to_rgb        \
        rgb_to_bgr              \
        rgb_to_ycbcr            \
@@ -21,7 +21,16 @@ TESTS =                              \
        cairo-RGB24             \
        $(CONCURRENCY_STRESS_TEST)
 
-TESTS_ENVIRONMENT = BABL_PATH=$(top_builddir)/extensions/.libs
+if HAVE_INTROSPECTION
+INTROSPECTION_TESTS = \
+       introspection.py
+endif
+
+TESTS = \
+       $(C_TESTS) \
+       $(INTROSPECTION_TESTS)
+
+TESTS_ENVIRONMENT = LD_LIBRARY_PATH=$(top_builddir)/babl:$LD_LIBRARY_PATH GI_TYPELIB_PATH=$(top_builddir)/babl BABL_PATH=$(top_builddir)/extensions/.libs
 
 AM_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/babl
 if OS_UNIX
@@ -33,6 +42,9 @@ LDADD = $(top_builddir)/babl/libbabl-@BABL_API_VERSION@.la \
 
 EXTRA_DIST=common.inc
 
+noinst_SCRIPTS = \
+       introspection.py
+
 noinst_PROGRAMS =              \
        introspect              \
        babl_fish_path_fitness  \
@@ -40,4 +52,4 @@ noinst_PROGRAMS =             \
        babl-html-dump          \
        conversions             \
        formats                 \
-       $(TESTS)
+       $(C_TESTS)
diff --git a/tests/introspection.py b/tests/introspection.py
new file mode 100755 (executable)
index 0000000..1e855aa
--- /dev/null
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+
+import unittest
+
+class TestSanity(unittest.TestCase):
+
+    def test_import(self):
+        import gi
+        from gi.repository import Babl
+
+    def test_init(self):
+        import gi
+        from gi.repository import Babl
+        Babl.init()
+        Babl.exit()
+
+if __name__ == '__main__':
+    unittest.main()